x=int(input())
s=map(str,input().split())
c=0
for i in s:
n=0
for j in i:
if j==j.upper():
n+=1
c=max(n,c)
print(c)
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define FastIO ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
const int N= 1e5+5,mod= 1e8+7;
int main(){
FastIO;
int t=1,cs=0; //cin>>t;
//cin.ignore();
while(t--){
string s;
ll n; cin>>n;
cin.ignore();
getline(cin,s);
ll cnt=0,ans=0;
//cout<<s<<endl;
for(ll i=0;i<s.size();i++){
if(s[i]==' '){
ans= max(ans,cnt);
cnt=0;
}
else if(s[i]>='A' && s[i]<='Z') cnt++;
}
ans= max(ans,cnt);
cout<<ans<<endl;
}
return 0;
}
/*
*/
566. Reshape the Matrix | 167. Two Sum II - Input array is sorted |
387. First Unique Character in a String | 383. Ransom Note |
242. Valid Anagram | 141. Linked List Cycle |
21. Merge Two Sorted Lists | 203. Remove Linked List Elements |
733. Flood Fill | 206. Reverse Linked List |
83. Remove Duplicates from Sorted List | 116. Populating Next Right Pointers in Each Node |
145. Binary Tree Postorder Traversal | 94. Binary Tree Inorder Traversal |
101. Symmetric Tree | 77. Combinations |
46. Permutations | 226. Invert Binary Tree |
112. Path Sum | 1556A - A Variety of Operations |
136. Single Number | 169. Majority Element |
119. Pascal's Triangle II | 409. Longest Palindrome |
1574A - Regular Bracket Sequences | 1574B - Combinatorics Homework |
1567A - Domino Disaster | 1593A - Elections |
1607A - Linear Keyboard | EQUALCOIN Equal Coins |